package com.yigo.prc.app.assembler;

import com.yigo.prc.api.spu.command.CreateSpuCmd;
import com.yigo.prc.domain.spu.entity.PrcSpu;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

/**
 * @author chenzl
 */
@Mapper
public interface SpuDTO2DmoAssembler {
    SpuDTO2DmoAssembler INSTANCE = Mappers.getMapper(SpuDTO2DmoAssembler.class);

    @Mapping(target = "category.categoryId", source = "categoryId")
    @Mapping(target = "category.categoryName", source = "categoryName")
    @Mapping(target = "unit.unitCode", source = "unitCode")
    @Mapping(target = "unit.unitName", source = "unitName")
    @Mapping(target = "brand.brandCode", source = "brandCode")
    @Mapping(target = "brand.brandName", source = "brandName")
    PrcSpu toDmo(CreateSpuCmd source);
}
